package com.sinog.biz.service.business.impl;

import com.sinog.biz.mapper.havexml.PrisonerTsMapper;
import com.sinog.biz.service.business.PrisonerTsService;
import com.sinog.core.model.PrisonerTsVo;
import com.sinog.core.model.UserDTO;
import com.sinog.core.utilbean.Constants;
import com.sinog.core.utilbean.Result;
import com.sinog.core.utilbean.ReturnCode;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @desc 预安置管理 - 推送记录
 * @author wangxj
 * @date 2022/9/3 11:11
 */
@RestController
public class PrisonerTsServiceImpl implements PrisonerTsService {

    @Resource
    private PrisonerTsMapper prisonerTsMapper;

    /**
     * 获取推送信息
     * @param id 核查信息编号
     * @param userDTO 当前登录用户对象
     * @return Result
     */
    @Override
    public Result searchBaseInfoByPriNum(String id,UserDTO userDTO) {
        PrisonerTsVo prisonerTs = prisonerTsMapper.searchBaseInfoByPriNum(id,userDTO.getAccount(),null,Constants.NumberStr.NUM_STR_ZERO);
        if(null != prisonerTs) {
            return Result.success(prisonerTs);
        }
        return Result.failure(ReturnCode.FAILURE);
    }

    /**
     * 根据推送ID获取推送信息
     * @param id 推送id
     * @return Result
     */
    @Override
    public Result searchBaseInfoById(String id) {
        PrisonerTsVo prisonerTsVo = prisonerTsMapper.searchBaseInfoById(id);
        if(null != prisonerTsVo) {
            return Result.success(prisonerTsVo);
        }
        return Result.failure(ReturnCode.FAILURE);
    }
}